<template>
  <div>
    <button @click="showOrNot">显示与隐藏</button>
    <h2 v-if="isShow">hello world</h2>
    <h2 v-show="isShow">hello world</h2>
    <ul>
      <li v-for="(fruit,index) in fruits" :key="index">
        <p>名称：{{fruit}}</p>
        <p>索引：{{index}}</p>
        </li>
    </ul>
    <table border="1">
      <thead>
        <th>序号</th>
        <th>姓名</th>
        <th>年龄</th>
      </thead>
      <tbody>
        <tr v-for="(student,index) in students" :key="index">
          <td>{{index+1}}</td>
          <td>{{student.name}}</td>
          <td>{{student.age}}</td>
        </tr>
      </tbody>
    </table>
    <Hello></Hello>
    <HelloVue></HelloVue>
  </div>
</template>

<script>
import Hello from "./components/Hello";
import HelloVue from "./components/HelloVue";
export default {
  components:{
    Hello,
    HelloVue
  },
  data(){
    return {
      isShow:true,
      fruits:["香蕉","苹果","鸭梨"],
      students:[
        {name:"小明",age:2},
        {name:"小亮",age:2},
        {name:"小红",age:2}
      ]
    }
  },
  methods:{
    showOrNot(){
      this.isShow = !this.isShow;
    }
  }
}
</script>

<style>

</style>
